/**
* @Title: DogController.java
* @Package com.an.SpringMvcl
* @Description: TODO(用一句话描述该文件做什么)
* @author antch,861710865@qq.com
* @date 2017年7月14日 下午3:25:55
* @version V1.0
*/


package com.an.SpringMvcl;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.an.model.Dog;

/**
* @ClassName: DogController
* @Description: TODO(Dog控制器类)
* @author antch,861710865@qq.com
* @date 2017年7月14日 下午3:25:55
*
*/
@Controller
@RequestMapping("/dog")
public class DogController {

	private static final Logger log = Logger.getLogger(DogController.class);
	
	@RequestMapping(produces="text/plain;charset=UTF-8")
	public @ResponseBody String index(HttpServletRequest request) {
		log.info("无参数调用");
		return "url:" + request.getRequestURL() + "能获取";
	}

	@RequestMapping(value="/pathvar/{str}",produces="text/plain;charset=UTF-8")
	public @ResponseBody String pathVar(@PathVariable String str,HttpServletRequest request) {
		return "url:" + request.getRequestURL() + "能获取,url中的数据：：" + str;
	}

	@RequestMapping(value="/requestPara",produces="text/plain;charset=UTF-8")
	public @ResponseBody String passRequestPara(Long id,HttpServletRequest request) {
		return "url:" + request.getRequestURL() + "能获取,id中的数据：：" + id;
	}

	@RequestMapping(value="/dogo",produces="application/json;charset=UTF-8")
	@ResponseBody
	public String passObj(Dog dog,HttpServletRequest request) {
		System.out.println(dog);
		return  request.getRequestURL() + "";
	}

	@RequestMapping(value= {"name1","name2"},produces="text/plain;charset=UTF-8")
	public @ResponseBody String remove(HttpServletRequest request) {
		return "url::" + request.getRequestURL() + "获取，，，。。。。";
	}
}
